package com.hehe.ai.langchain4j.controller;

import com.hehe.ai.langchain4j.assistant.HeheAgent;
import com.hehe.ai.langchain4j.bean.ChatForm;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @author: hehe
 * @create: 2025-05-14 15:06
 * @Description:
 */
@RestController
@Tag(name = "hehe", description = "hehe")
@RequestMapping("/hehe")
@RequiredArgsConstructor
public class HeheController {

    private final HeheAgent agent;

    @Operation(summary = "对话")
    @PostMapping(value="/chat", produces = "text/stream;charset=utf-8")
    public Flux<String> chat(@RequestBody ChatForm chatForm){
        System.out.println(chatForm);
        return agent.chat(chatForm.getMemoryId(),chatForm.getMessage());
    }
}
